package com.toune.villager.adapter

import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.toune.villager.R
import com.zia.easybookmodule.bean.Book
import kotlinx.android.synthetic.main.adapter_book.view.*

class BookAdapter(layoutResId: Int, data: MutableList<Book>?) :
    BaseQuickAdapter<Book, BaseViewHolder>(layoutResId, data) {
    override fun convert(holder: BaseViewHolder, item: Book) {
        Glide.with(context).load(item.imageUrl).into(holder.getView(R.id.srcIv))
        holder.setText(R.id.bookNameTv, item.bookName)
        holder.setText(R.id.chapterSizeTv, item.chapterSize)
        holder.setText(R.id.classifyTv, item.classify)
        holder.setText(R.id.statusTv, item.status)
        holder.setText(R.id.lastUpdateTimeTv, "上次更新时间：${item.lastUpdateTime}")
        holder.setText(R.id.lastChapterNameTv, "最新章节：${item.lastChapterName}")
        holder.setText(R.id.siteNameTv, "数据源：${item.siteName}")
        holder.setText(R.id.introduceTv, "简介：${item.introduce}")
    }
}